"""
分析相关数据模式
"""

from pydantic import BaseModel
from typing import Optional, Dict, Any
from datetime import datetime


class AnalysisRequest(BaseModel):
    """分析请求模式"""
    requirement_text: Optional[str] = None
    

class AnalysisResponse(BaseModel):
    """分析响应模式"""
    success: bool
    analysis: Optional[str] = None
    error: Optional[str] = None
    file_info: Optional[Dict[str, Any]] = None
    record_id: Optional[int] = None


class TestCaseRequest(BaseModel):
    """测试用例生成请求模式"""
    requirement_text: Optional[str] = None


class TestCaseResponse(BaseModel):
    """测试用例生成响应模式"""
    success: bool
    test_cases: Optional[str] = None
    error: Optional[str] = None
    file_info: Optional[Dict[str, Any]] = None
    record_id: Optional[int] = None


class AnalysisHistoryResponse(BaseModel):
    """分析历史响应模式"""
    id: int
    analysis_type: str
    file_name: Optional[str]
    file_type: str
    status: str
    error_message: Optional[str]
    created_at: datetime
    processing_time: Optional[float]


class AnalysisDetailResponse(BaseModel):
    """分析详情响应模式"""
    id: int
    analysis_type: str
    input_content: Optional[str]
    output_content: Optional[str]
    file_name: Optional[str]
    file_type: str
    file_size: Optional[int]
    processing_time: Optional[float]
    status: str
    error_message: Optional[str]
    ai_model: Optional[str]
    tokens_used: Optional[int]
    created_at: datetime


class SaveAnalysisRequest(BaseModel):
    """保存分析结果请求模式"""
    content: str
    filename: Optional[str] = None
    record_id: Optional[int] = None


class DocumentProcessResponse(BaseModel):
    """文档处理响应模式"""
    success: bool
    content: Optional[str] = None
    error: Optional[str] = None
    file_info: Optional[Dict[str, Any]] = None 